/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.comeval.logica;

import com.comeval.modelo.Rol;
import com.comeval.persistencia.IRolDAO;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author LUISA
 */
@Stateless
public class LogicaRol implements LogicaRolLocal {

    @EJB
    private IRolDAO rolDAO;
    
    @Override
    public List<Rol> consultar() throws Exception {
        return rolDAO.consultar();
    }

    @Override
    public Rol consultarPorRol(Integer rol) throws Exception {
        if(rol==null){
            throw new Exception("El rol no se encuentra registrado");
        }
        return rolDAO.consultarPorRol(rol);
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
